package cn.itcast.consumer.web;

import cn.itcast.consumer.config.RedisProperties;
import cn.itcast.consumer.feign.UserFeignApi;
import cn.itcast.consumer.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 * @author ITHEIMA
 */
@RestController
@RequestMapping("consumer")
public class ConsumerController {

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private RedisProperties redisProperties;

    @Autowired
    UserFeignApi userFeignApi;

    @GetMapping(value = "/rest/{id}" )
    public User consumerUserById(@PathVariable("id") String id,@RequestHeader("Authorization") String token){
        System.out.println(token);
        return userFeignApi.queryById(id,token);
    }

    @GetMapping("/hello")
    public RedisProperties disUserById(){
        return redisProperties;
    }
}
